﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SuperCalculator
{
    public partial class frmAddFunctionGuide : Form
    {
        public string FunctionName = "";

        /// <summary>
        /// 用于说明函数的简短信息
        /// </summary>
        public string ExplainInfo = "";


        public frmAddFunctionGuide()
        {
            InitializeComponent();
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }

        private void buttonOk_Click(object sender, EventArgs e)
        {
            string input = this.textBoxFunctionName.Text.Trim();
            if (String.IsNullOrEmpty(input))
            {
                this.labelInfo.Text = "函数名不能为空";
                return;
            }
            else
            {
                for (int i = 0; i < input.Length; i++)
                {
                    if (!char.IsLetter(input[i]))
                    {
                        this.labelInfo.Text = "函数名只能为字母";
                        return;
                    }
                }
            }

            this.FunctionName = input;
            this.ExplainInfo = this.textBoxExplainInfo.Text;

            this.DialogResult = DialogResult.OK;
        }
    }
}
